﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PointTracker
{
    public partial class forgotPassword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void GetPassword(object sender, EventArgs e)
        {
            if (!TextBoxFname.Text.Trim().Equals("") &&
                !TextBoxLname.Text.Trim().Equals("") &&
                !TextBoxEmail.Text.Trim().Equals("") &&
                !TextBoxPassword.Text.Equals("") &&
                TextBoxPassword.Text.Equals(TextBoxVpassword.Text))
            {
                Boolean successful = PointTracker.DatabaseManager.getPassword(TextBoxFname.Text, TextBoxLname.Text, TextBoxEmail.Text, TextBoxPassword.Text);
                if (successful)
                {
                    divPassword.Style.Add("color", "green");
                    divPassword.InnerText = "Your password has been successfully changed to '" + TextBoxPassword.Text + "'";
                }
                else
                {
                    divPassword.Style.Add("color", "red");
                    divPassword.InnerText = "Password update failed, user not found";
                }
                //divPassword.InnerText = password;
            }
        }
    }
}